<?php
/**
 * Slipstream :: Highly adaptive dependency injection framework
 * Copyright 2010-2011 Ian Unruh (Xerof3ar)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Slipstream\Configuration;

use Countable;
use IteratorAggregate;

/**
 * A context is a set of policies that affect a certain identifier
 * 
 * @author Ian Unruh (Xerof3ar) <ianunruh@gmail.com>
 * @since Class avaliable since release 1.0
 */
interface ContextInterface extends Countable, IteratorAggregate
{
	/**
	 * Binds a policy to this context
	 * 
	 * @param PolicyInterface $policy
	 * @return void
	 */
	public function bind(PolicyInterface $policy);
	
	/**
	 * Returns a child context with a given identifier
	 * 
	 * @param string $identifier
	 * @return ContextInterface
	 */
	public function getChildContext($identifier);
	
	/**
	 * Returns the children contexts of this context
	 * @return ArrayObject<ContextInterface>
	 */
	public function getChildren();
	
	/**
	 * Returns the identifier that this context affects
	 * @return string
	 */
	public function getIdentifier();
	
	/**
	 * Returns parent context of this context (if any)
	 * @return ContextInterface
	 */
	public function getParentContext();
	
	/**
	 * Returns the path to this context
	 * @return string
	 */
	public function getPath();
	
	/**
	 * Returns a set of the policies bound to this context
	 * @return SplObjectStorage<PolicyInterface>
	 */
	public function getPolicies();
}